package com.nju.bean.ftp;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

import com.nju.bean.client.preference.C;

public class Updater {
	public static int getLastVersion() throws IOException{
		File f= new File(C.PHOTO_PATH+File.separator+C.versionFileName);
		if(f.exists())
			f.delete();
		ContinueFTP ftp = new ContinueFTP();
		ftp.connect(C.HOST_IP_STRING, "bean","bean");
		ftp.download("apk/last.txt", C.PHOTO_PATH+File.separator+C.versionFileName);
		BufferedReader br = new BufferedReader(new FileReader(f));
		int version = Integer.parseInt(br.readLine());
		return version;
	}
}